home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / full / jbuild / setup / JBuilder / jruntime.z / misc.jar / sun / demo / misc / Voter.class (.txt) < prev   
Encoding:
Java Class File  |  1996-12-17  |  1.0 KB  |  35 lines

  1. package sun.demo.misc;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Font;
  6. import java.awt.Label;
  7. import java.beans.PropertyChangeEvent;
  8. import java.beans.PropertyVetoException;
  9.  
  10. public class Voter extends Label {
  11.    private boolean vetoAll = true;
  12.  
  13.    public Voter() {
  14.       super("No");
  15.       ((Component)this).setFont(new Font("Helvetica", 1, 36));
  16.       ((Component)this).setBackground(Color.black);
  17.       ((Component)this).setForeground(Color.red);
  18.    }
  19.  
  20.    public void setVetoAll(boolean var1) {
  21.       this.vetoAll = var1;
  22.       ((Label)this).setText(this.vetoAll ? "No" : "Yes");
  23.    }
  24.  
  25.    public boolean getVetoAll() {
  26.       return this.vetoAll;
  27.    }
  28.  
  29.    public void vetoableChange(PropertyChangeEvent var1) throws PropertyVetoException {
  30.       if (this.vetoAll) {
  31.          throw new PropertyVetoException("NO!", var1);
  32.       }
  33.    }
  34. }
  35.